﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Light.Framework.Model;
using Light.Utility;

namespace Light.Framework.Contract
{
    /// <summary>
    /// 登录组件接口（实现此接口的类表示可执行登录操作）
    /// </summary>
    public interface IUserComponent
    {
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="user">传递用户登录信息 username,password...</param>
        /// <returns></returns>
        OperateResult Login(IUser user);

        /// <summary>
        /// 退出登录
        /// </summary>
        OperateResult Logout();

        /// <summary>
        /// 重置登录密码
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        OperateResult ResetPassword(string id);

        /// <summary>
        /// 修改登录密码
        /// </summary>
        /// <param name="usernam"></param>
        /// <param name="oldpassword"></param>
        /// <param name="newpassword"></param>
        /// <returns></returns>
        OperateResult ChangePassword(string username, string oldpassword, string newpassword);

        /// <summary>
        /// 根据Token获取登录用户
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        IUser GetByToken(string token);
    }
}
